<div class="row">
    <div class="col-md-12">
        <div class="btn-toolbar" role="toolbar">
            <div class="btn-group" uib-dropdown is-open="status.isopen">
                <button class="btn btn-sm btn-default dropdown-toggle" uib-dropdown-toggle ng-disabled="selection.artifacts.length == 0" type="button">
                    {{uiSrv.actions[selection.Action]}}
                    <span class="caret"></span>
                </button>
                <ul class="dropdown-menu" uib-dropdown-menu style="font-size:0.9em">
                    <li>
                        <a ng-click="selection.Action = 'export';toggleTEList()">Export</a>
                    </li>
                    <li class="divider"></li>
                    <li>
                        <a ng-click="selection.isCollapsed=true;selection.Action = 'changeSightedFlog'">Change sighted flag</a>
                    </li>
                    <li>
                        <a ng-click="selection.isCollapsed=true;selection.Action = 'changeIOCFlog'">Change IOC flag</a>
                    </li>
                    <li>
                        <a ng-click="selection.isCollapsed=true;selection.Action ='changeTlp'">Change TLP</a>
                    </li>
                    <li>
                        <a ng-click="selection.isCollapsed=true;selection.Action ='addTags';evalTtags();">Add tag</a>
                    </li>
                    <li ng-if="analysisEnabled">
                        <a ng-click="selection.Action ='runAnalyzers'; activeAnalyzers();">Run analyzers</a>
                    </li>
                    <li class="divider"></li>
                    <li>
                        <a href ng-click="selection.isCollapsed=true;selection.Action = 'remove'">
                            <span class="text-danger">Delete</span>
                        </a>
                    </li>
                </ul>
            </div>

            <div class="btn-group">
                <button class="btn btn-sm btn-primary" ng-click="addArtifact()">
                    <i class="glyphicon glyphicon-plus"></i>
                    Add observable(s)
                </button>
            </div>

            <div class="btn-group">
                <h5 ng-if="selection.artifacts.length > 0 ">
                    <em>{{selection.artifacts.length}}
                        observable(s) selected</em>
                </h5>
            </div>

            <div class="btn-group pull-right" role="group">
                <page-sizer collection="artifacts" sizes="[10, 15, 30, 100]"></page-sizer>
            </div>

            <div class="btn-group pull-right" role="group">
                <button class="btn btn-sm" ng-class="{true: 'btn-primary', false:'btn-default'}[uiSrv.context.showFilters]" type="button" ng-click="toggleFilters()">
                    <i class="fa fa-search"></i> Filters
                </button>
            </div>

            <div class="btn-group pull-right" role="group">
                <button class="btn btn-sm" ng-class="{true: 'btn-primary', false:'btn-default'}[uiSrv.context.showStats]" type="button" ng-click="toggleStats()">
                    <i class="fa fa-bar-chart"></i> Stats
                </button>
            </div>
        </div>
    </div>
</div>

<br>

<!-- <pre>{{uiSrv.context | json}}</pre> -->

<div class="filter-panel" ng-include="'views/partials/observables/list/mini-stats.html'" ng-show="uiSrv.context.showStats"></div>
<br>

<div class="filter-panel" ng-include="'views/partials/observables/list/filters.html'" ng-show="uiSrv.context.showFilters"></div>

<!-- collapse for Tags + TLP + Delete -->
<div class="row" uib-collapse="!selection.isCollapsed">
    <div ng-include="'views/partials/observables/list/artifacts-list-sighted.html'" ng-if="selection.Action === 'changeSightedFlog'"></div>
    <div ng-include="'views/partials/observables/list/artifacts-list-ioc.html'" ng-if="selection.Action === 'changeIOCFlog'"></div>    
    <div ng-include="'views/partials/observables/list/artifacts-list-tlp.html'" ng-if="selection.Action === 'changeTlp'"></div>
    <div ng-include="'views/partials/observables/list/artifacts-list-delete.html'" ng-if="selection.Action === 'remove'"></div>
    <div ng-include="'views/partials/observables/list/artifacts-list-tags.html'" ng-if="selection.Action === 'addTags'"></div>
</div>

<div class="row">
    <div class="selection-options" ng-if="selection.Action === 'runAnalyzers'">
        <div ng-include="'views/partials/observables/list/artifacts-list-analyzers.html'"></div>
    </div>
</div>

<br>
<!-- Main page : Table + Text/CSV -->
<div class="row">
    <div class="selection" ng-if="selection.Action === 'export'">
        <div ng-include="'views/partials/observables/list/artifacts-list-export.html'"></div>
    </div>
    <div class="selection" ng-if="selection.Action !== 'export'">
        <div ng-include="'views/partials/observables/list/artifacts-list-main.html'"></div>
    </div>
</div>
